package com.onelap.bls.tc.utils;

import android.content.Context;
import android.content.Intent;

import com.blankj.utilcode.util.ActivityUtils;
import com.google.gson.Gson;

import java.util.HashMap;

public class BlsIntentUtils {

    public static void startActivity(Context packageContext, Class<?> cls, HashMap<String, Object> keyValue) {
        Intent intent = new Intent();
        for (String key : keyValue.keySet()) {
            intent.putExtra(key, new Gson().toJson(keyValue.get(key)));
        }
        intent.setClass(packageContext, cls);
        packageContext.startActivity(intent);
    }


    public static void startActivity(Class<?> cls, HashMap<String, Object> keyValue) {
        Intent intent = new Intent();
        for (String key : keyValue.keySet()) {
            intent.putExtra(key, new Gson().toJson(keyValue.get(key)));
        }
        intent.setClass(ActivityUtils.getTopActivity(), cls);
        ActivityUtils.getTopActivity().startActivity(intent);
    }
}
